﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
using HgCo.WindowsLive.SkyDrive;

namespace test1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            HgCo.WindowsLive.SkyDrive.SkyDriveWebClient _client = new SkyDriveWebClient();
            _client.LogOn("whsbackup@hotmail.com", "qazxsw");
            _client.CreateRootWebFolder("WHSBackup", WebFolderItemShareType.Private);
            WebDriveInfo _info = _client.GetWebDriveInfo();

            WebFolderInfo[] _webFolderInfo = _client.ListRootWebFolders();
            
            foreach (WebFolderInfo webFolderInfo in _webFolderInfo)
            {
                if(webFolderInfo.Name == "WHSBackup")
                {
                    _client.UploadWebFile(@"C:\Chrysler.txt", webFolderInfo);
                }
            }

            chart1.Series["Series1"].Points.AddXY("Used Space", decimal.Parse(_info.UsedDiskSpace.Replace(" GB", "").Replace(" MB", "")));
            chart1.Series["Series1"].Points.AddXY("Free Space", decimal.Parse(_info.FreeDiskSpace.Replace(" GB", "").Replace(" MB", "")));
            chart1.Series["Series1"].IsValueShownAsLabel = true;
            chart1.Series["Series1"]["LabelStyle"] = "Center";



            richTextBox1.Text = _info.Cid + "____" + _info.FreeDiskSpace + "____" + _info.FreeDiskSpaceMax + "____" +
                                _info.UsedDiskSpace + "____";// + +"____" + +"____" + +"____";
        }
    }
}
